/*
 * @Descripttion:
 * @version:
 * @Author: sueRimn
 * @Date: 2020-11-16 09:56:10
 * @LastEditors: sueRimn
 * @LastEditTime: 2020-11-16 10:00:16
 */
import store from '@/store/index'

// 夹带k_token
export function addK_Token(data) {
    var token = {
        k_token: store.getters.k_token
    }
    Object.assign(data, token)
    return data
}

// 转换携带id URL
export function checkHasID(url, data) {
    var reg = RegExp(/<[^<>]+>/g)
    if (reg.test(url)) {
        var arr = url.split('/')
        var id = arr[arr.length - 1].replace(/\<|\>/g, '').trim()
        var header = url.replace(/<[^<>]+>/g, '')
        return header + data[id]
    } else {
        return url
    }
}
